<?php
/**
 * Created by Command.
 * User: Vito
 */

declare (strict_types = 1);

namespace app\admin\controller\v1;

use app\admin\controller\BaseController;
use app\logic\PollingTypeLogic;

class PollingType extends BaseController
{
    protected $name = '巡检类型';

    protected $registerCurd = true;

    protected $registerCurdDir = true;

    protected $methodName = [
        'getDetail'     => '获取巡检详情',
        'saveDetail'    => '编辑巡检详情'
    ];
    /**
     * 初始化
     */
    protected function initialize()
    {
        $this->logic = new PollingTypeLogic();
    }

    public function getDetail(){
        
        $params = $this->request->get();

        $res = $this->logic->getPollingType($params);

        if($res){
           return success($res,'获取成功');
        }else{
            return error('获取失败');
        }
    }

    public function saveDetail(){

        $params = $this->request->post();
        // halt($params);
        $res = $this->logic->savePollingType($params);

        if($res){
            return success($res, '修改成功');
        } else {
            return error('修改失败');
        }
    }
}
